#include "stdafx.h"
#include "MessageCallBack.h"
#include "google/protobuf/descriptor.h"
#include "MessageCallBack/MessageCallBack.h"
#include "MessageCallBack/loginCallBack.h"
#include "ProtoBuf/Client2Game/heartbeat.pb.h"
#include "boost/bind.hpp"


void MessageDispather::init()
{
	RegisterMessageCallBack<loginRequest>(boost::bind(&loginRequestCallBack::process,_1,_2));
	RegisterMessageCallBack<logoutRequest>(boost::bind(&logoutRequestCallBack::process,_1,_2));
	RegisterMessageCallBack<heartbeat>(boost::bind(&heartbeatCallBack::process,_1,_2));
}


Message_CallBack* MessageDispather::getMessageCallBack( const string& name )
{
	if (s_messageDispatcher.find(name) != s_messageDispatcher.end())
	{
		return &s_messageDispatcher[name];
	}
	else
		return NULL;
}

std::map<std::string,Message_CallBack> MessageDispather::s_messageDispatcher;


